<?php
if (!defined('APP_PATH')) {
	define('APP_PATH', $_SERVER['DOCUMENT_ROOT']."/bdACPA");
}
require_once(APP_PATH.'/required.php');

header("Content-type:text/xml");
echo("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

$out = "<items>";
$out .=	"<item type='settings' position='label-left' labelWidth='auto' inputWidth='120'/>";
$out .= "<item type='radio' name='typeRecherche' labelWidth='auto' value='region' position='label-right' label='Visualiser une région' checked='true'>";
$out .= "<item type='fieldset' width='400' label='Par position'>";
$out .= "	<item type='input' name='parGene' label='Nom de gène (ex : MAPT)' value=''/>";
$out .= "	<item type='input' name='parBande' label='Bande' value=''/>";
$out .= "	<item type='input' name='parChromosome' label='Chromosome' value=''/>";
$out .= "	<item type='input' name='parPosition' label='Position (ex : chr7:71890181..72690180)' value=''/>";
$out .= "</item>";
if (isset($utilisateur)){
	$out .= "<item type='fieldset' width='400' label='Filtrer les CNV à afficher par'>";
	$out .= "	<item type='input' name='parMarque' label='Marque de puce' value=''/>";
	$out .= "	<item type='input' name='parModele' label='Modèle de puce' value=''/>";
	$out .= "	<item type='input' name='parPhenotype' label='Phénotype de la personne' value=''/>";
	$out .= "</item>";
}

$out .= "</item>";

if (isset($utilisateur)){
	$out .= "<item type='radio' name='typeRecherche' value='analyse' labelWidth='auto' position='label-right' label='Rechercher une analyse'>";
	$out .= "<item type='fieldset' width='400'>";
	$out .= "	<item type='input' name='parPhenotypePersonne' label='Phénotype de la personne' value=''/>";

	$categorieBiomeds = $CATEGORIEBIOMED_DAO->rechercher_categorie();
	$centres = $CENTRE_DAO->rechercher_centre();

	$out .= "<item type='checkbox' name='prenatal'  id='prenatal'  value='prenatal' labelWidth='auto' position='label-right' label='Prénatal' >";
	$out .= "	<item type='combo' name='categoriePrenatal' width='250' >";
	$out .= "<option value='0' text='Tous les prénataux' selected='true'/>";
	foreach ($categorieBiomeds as $categorieBiomed){
		if ($categorieBiomed->idtypecategorie == 1){
			$out .= "		<option value='".$categorieBiomed->idcategorie."' text='".str_replace ("'", "´", $categorieBiomed->libelle )."' />";
		}
	}
	$out .= "	</item>";
	$out .= "</item>";

	$out .= "<item type='checkbox' name='postnatal' id='postnatal' value='postnatal' labelWidth='auto' position='label-right' label='Postnatal' >";
	$out .= "	<item type='combo' name='categoriePostnatal' width='250' >";
	$out .= "<option value='0' text='Tous les postnataux' selected='true'/>";
	foreach ($categorieBiomeds as $categorieBiomed){
		if ($categorieBiomed->idtypecategorie == 2){
			$out .= "		<option value='".$categorieBiomed->idcategorie."' text='".str_replace ("'", "´", $categorieBiomed->libelle)."' />";
		}
	}
	$out .= "	</item>";
	$out .= "</item>";

	$out .= "<item type='checkbox' name='foetopat' value='foetopat' id='foetopat' labelWidth='auto' position='label-right' label='Foetopathologie' >";
	$out .= "	<item type='combo' name='categorieFoeto' width='250'>";
	$out .= "<option value='0' text='Toutes les foetopathologies' selected='true'/>";
	foreach ($categorieBiomeds as $categorieBiomed){
		if ($categorieBiomed->idtypecategorie == 3){
			$out .= "		<option value='".$categorieBiomed->idcategorie."' text='".str_replace ("'", "´", $categorieBiomed->libelle)."' />";
		}
	}
	$out .= "	</item>";
	$out .= "</item>";

	$out .= "	<item type='combo' name='parCentre' label='Provenant du centre'>";
	$out .= "<option value='0' text='Tous les centres' selected='true'/>";
	foreach ($centres as $centre){
			$out .= "		<option value='".$centre->idcentre."' text='".str_replace ("'", "´", $centre->nom)."' />";
	}

	$out .= "	</item>";


	$out .= "</item>";
	$out .= "</item>";
}
$out .=  "<item type='button' value='Rechercher' name='rechercher' command='rechercher' />";
$out .= "</items>";
print($out);
?>